package frontEnd;

import entity.BusEntity;
import entity.UserBusDto;
import entity.UserBusMappingEntity;
import util.CommonUtil;

import java.util.List;

/**
 * @author HuangJH
 * @create 2023-11-30-18:00
 * 模拟页面
 */
public class Web {

    public static void printfError(int num) {
        System.out.println("请输入正确选择，您的输入是：" + num);
    }

    public static void printfAllBus(List<BusEntity> allBus) {
        System.out.println("==========================================");
        System.out.println("全部班车信息如下");
        for (int i = 0; i < allBus.size(); i++) {
            BusEntity busEntity = allBus.get(i);
            System.out.println("班车编号：" + (i + 1 )+ " || 名称：" + busEntity.getBusName() + " || 始发站：" + busEntity.getDepartureStation() + " || 终点站：" + busEntity.getTerminal());
        }

    }

    public static void printfAllUserBus(List<UserBusDto> allUserBus) {
        System.out.println("==========================================");
        System.out.println("当前用户已预约全部班车信息如下");
        for (int i = 0; i < allUserBus.size(); i++) {
            UserBusDto userBusDto = allUserBus.get(i);
            UserBusMappingEntity userBusMappingEntity = userBusDto.getUserBusMappingEntity();
            BusEntity busEntity = userBusDto.getBusEntity();
            System.out.println("预约号："+ userBusMappingEntity.getId() + " || 班车编号：" + (i + 1 )+ " || 名称：" + busEntity.getBusName() + " || 始发站："
                    + busEntity.getDepartureStation() + " || 终点站：" + busEntity.getTerminal() + " || 预约时间：" + CommonUtil.formatDate(userBusMappingEntity.getAppointmentTime()));
        }
    }


}
